// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
//路由固定写法
import Vue from 'vue'
import vueRouter from 'vue-router'
import vueResource from 'vue-resource'

//导入相关vue包
// 导入mint-ui
import mintUI from 'mint-ui';
// 导入moment.js
import moment from 'moment';
Vue.use(mintUI); 
//自定全局样式，可以覆盖mint-ui和其他ui的样式
import '../static/css/site.css';
// 导入 mint-ui 的css
import 'mint-ui/lib/style.min.css';

// 导入 mui 的css
import '../static/mui/css/mui.css';
// 导入 mui 的js
// import '../static/mui/js/mui.min.js';
//要找到文字组件
import '../static/mui/css/icons-extra.css';

// Vue.prototype.vueobjvue = new Vue({}); 




//vueRouter加载vue里的
Vue.use(vueRouter);
Vue.use(vueResource);//使用vueResource 对象才自动在vue挂在http
// 加载图片预览组件vue-perivew
import VuePreview from 'vue-preview';
Vue.use(VuePreview)

//注册全局过滤器叫tolowercase1
// Vue.filter('tolowercase',function(input){
// 	return input.toLowerCase() +'-->from Global';
// });
//注册全局过滤器叫moment.js日期  fmtdate()
Vue.filter('fmtdate',function(input,datefmtstring){
	//传入的datefmtstring的格式种类很多，要if判断很多！比较复杂、用了moment.js
	 return moment(input).format(datefmtstring);

});


  

//定义路由对象
import App from './App.vue';
import Home from './components/Home/Home.vue';
import memder from './components/memder/memder.vue';
import field  from './components/memder/field.vue';
import shopcar from './components/shopcar/shopcar.vue';
import search from './components/search/search.vue';
import newslist from './components/news/newslist.vue';
import newsinfo from './components/news/newsinfo.vue';
import photolist from './components/photo/photolist.vue';
import photoinfo from './components/photo/photoinfo.vue';
import goodslist from './components/goods/goodslist.vue';
import goodsinfo from './components/goods/goodsinfo.vue';
import goodscommont from './components/goods/goodscommont.vue';
import goodsdesc from './components/goods/goodsdesc.vue';
import login from './components/login/login.vue';





let router = new vueRouter({
  linkActiveClass:'mui-active',
	routes:[
		//让第一次打开自动加载home组件(redirect自动跳转的意思)
		{name:'root',path:'/',redirect:'/Home'},
		{name:'home',path:'/Home',component:Home},
		{name:'memder',path:'/memder',component:memder},
		{name:'field',path:'/field',component:field},
		{name:'shopcar',path:'/shopcar',component:shopcar},
		{name:'search',path:'/search',component:search},
		{name:'newslist',path:'/news/newslist',component:newslist},//图文列表路由
		{name:'newsinfo',path:'/news/newsinfo:id',component:newsinfo},//图文详情路由
		{name:'photolist',path:'/photo/photolist',component:photolist},//图文详情路由
		{name:'photoinfo',path:'/photo/photoinfo',component:photoinfo},//图文详情id
		{name:'goodslist',path:'/goods/goodslist',component:goodslist},//商品
		{name:'goodsinfo',path:'/goods/goodsinfo',component:goodsinfo},//商品图文详情id
		// {name:'goodscommont',path:'/goods/goodscommont:id',component:goodscommont}，//商品评论，图文两个组件id值样式
		{name:'goodscommont',path:'/goods/goodscommont',component:goodscommont},	//商品评论组件
		{name:'goodsdesc',path:'/goods/goodsdesc',component:goodsdesc},	//商品图文组件
		{name:'login',path:'/login/login',component:login}


	]
});












//使用router
new Vue({
	el:'#app',
	router,
	render:c=>c(App)
});
